package bmaso.purest.mock;

import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
import java.util.Vector;

import javax.servlet.http.Cookie;

import com.mockobjects.servlet.MockHttpServletRequest;

public class MyMockHttpServletRequest extends MockHttpServletRequest {
	private Vector headers = new Vector();
	private List<Cookie> cookies = new LinkedList<Cookie>();
	
	@Override
	public Enumeration getHeaderNames() {
		return headers.elements();
	}

	@Override
	public void setupAddHeader(String headerName, String value) {
		super.setupAddHeader(headerName, value);
		headers.add(headerName);
	}
	
	public void setupCookie(Cookie cookie) {
		cookies.add(cookie);
	}

	@Override
	public Cookie[] getCookies() {
		return cookies.toArray(new Cookie[cookies.size()]);
	}
	
}
